{% extends base_template %}
{% load i18n xadmin_tags %}

{% block extrastyle %}{{ block.super }}
<style>
  .timeline-body > img{
    max-width: 100%;
  }
  .file-list > dd{
    box-shadow: none;
    border-radius: 0;
    border-bottom: 1px solid #f4f4f4;
    padding-bottom: 5px;
    margin-bottom: 5px;
  }
  .file-list > dd:last-child{    
    border-bottom: none;
    padding-bottom: 0px;
    margin-bottom: 0px;
  }
</style>
{% endblock %}
{% block bodyclass %}dashboard{% endblock %}
{% block breadcrumbs %}{% endblock %}

{% block content_title %}
  {% if icon %}<i class="{{icon}}"></i>{%endif%} {{ title }}
{% endblock %}
{% block nav_title %}
<i class="fa fa-clock-o" aria-hidden="true"></i> <strong>今日</strong> <span class="text-red">{{today|date:"Y-m-d D"}}</span>
{% endblock %}

{% block nav_toggles %}
{% if has_add_widget_permission %}
  <a title="{% trans "Add Widget" %}" href="{{ add_widget_url }}" class="navbar-toggle pull-right">
    <i class="fa fa-plus"></i></a>
{% endif %}
{% endblock %}

{% block nav_btns %}
{% if has_add_widget_permission %}
  <a title="{% trans "Add Widget" %}" href="{{ add_widget_url }}" class="btn btn-primary">
    <i class="fa fa-plus"></i> <span>{% trans "Add Widget" %}</span></a>
{% endif %}
{% endblock %}

{% block content %}
<div class="dashboard row">
  {% for c in columns %}
  <div class="{{ c.0 }} column">
    {% ifequal c.0 "col-sm-8" %}
    <div class="box box-solid">
      <div class="box-header with-border">
        <h3 class="box-title text-orange"><i class="fa fa-bullhorn" aria-hidden="true"></i> 管理员公告</h3>
      </div>
      <div class="box-body">
        {% if notify %}
        <p><strong>{{notify.subject}}</strong></p>
        <div>{{notify.content|safe}}</div>
        <small class="text-muted"><i class="fa fa-clock-o" aria-hidden="true"></i>&nbsp;&nbsp;<span>{{notify.createdat|timesince}}</span>前-{{notify.createdat}}</small>
        {% else %}
        <p class="text-red">没有新的公告</p>
        {% endif %}
      </div>
    </div>
    {% endifequal %}
    {% ifequal c.0 "col-sm-4" %}
    <div class="row">
      <div class="col-md-6 col-sm-6 col-xs-12">
        <div class="info-box">
          <span class="info-box-icon bg-green"><i class="fa fa-share-alt" aria-hidden="true"></i></span>
          <div class="info-box-content">
            <span class="info-box-text">通知</span>
            <span class="info-box-number">{{notice_count|default:"--"}}</span>
          </div>
          <!-- /.info-box-content -->
        </div>
        <!-- /.info-box -->
      </div>
      <div class="col-md-6 col-sm-6 col-xs-12">
        <div class="info-box">
          <span class="info-box-icon bg-yellow"><i class="fa fa-suitcase" aria-hidden="true"></i></span>
          <div class="info-box-content">
            <span class="info-box-text">公文</span>
            <span class="info-box-number">{{officedoc_count|default:"--"}}</span>
          </div>
          <!-- /.info-box-content -->
        </div>
        <!-- /.info-box -->
      </div>
    </div>
    {% if extlinks|length > 0 %}
    <div class="box box-solid">
      <div class="box-header with-border">
        <h3 class="box-title text-orange"><i class="fa fa-location-arrow" aria-hidden="true"></i> 外部链接</h3>
      </div>
      <div class="box-body no-padding">
        <ul class="nav nav-stacked">
          {% for l in extlinks %}
          <li><a href="{{l.url}}" target="_blank"><i class="fa fa-mouse-pointer" aria-hidden="true"></i> {{l.url}} <span class="pull-right">...</span></a></li>
          {% endfor %}
        </ul>
      </div>
    </div>
    {% endif %}
    {% endifequal %}
    {% for widget in c.1 %}
      {{ widget.widget|safe }}
    {% endfor %}
  </div>
  {% endfor %}
</div>
<input type='hidden' id='_portal_key' value='{{ portal_key }}' />
{% endblock %}
{% block extrabody %}
<script type="text/javascript">
$(function() {
  $(".timeline-body img").attr("style","width:auto;max-width:100%;");
});
</script>
{% endblock %}
